import request from '@/config/axios'

export interface ProductCategoryVO {
  id: number
  parentId: number
  categoryName: string
  description: string
  picUrl: string
  sortNo: number
  status: byte
}

// 查询商品分类列表
export const getProductCategoryPage = async (params) => {
  return await request.get({ url: `/train/product-category/page`, params })
}

// 查询商品分类详情
export const getProductCategory = async (id: number) => {
  return await request.get({ url: `/train/product-category/get?id=` + id })
}

// 新增商品分类
export const createProductCategory = async (data: ProductCategoryVO) => {
  return await request.post({ url: `/train/product-category/create`, data })
}

// 修改商品分类
export const updateProductCategory = async (data: ProductCategoryVO) => {
  return await request.put({ url: `/train/product-category/update`, data })
}

// 删除商品分类
export const deleteProductCategory = async (id: number) => {
  return await request.delete({ url: `/train/product-category/delete?id=` + id })
}

// 导出商品分类 Excel
export const exportProductCategory = async (params) => {
  return await request.download({ url: `/train/product-category/export-excel`, params })
}
